package com.kele.order;

import java.util.ArrayList;
import java.util.List;

public class TestListIter {

    public static void main(String[] args) {
        List<String> old = new ArrayList<>();
        old.add("1");
        old.add("2");
        old.add("3");
        old.add("4");
        old.add("5");

        List<String> old1 = new ArrayList<>();
        old1.add("1");
        old1.add("2");

        /*Iterator<String> iterator = old.iterator();
        while (iterator.hasNext()){
            String next = iterator.next();
            for (String s1 : old1) {
                if(next.equals(s1)){
                    iterator.remove();
                }
            }
        }*/

        for (int i=0;i<old.size();i++) {
            String s= old.get(i);
            for (String s1 : old1) {
                if(s.equals(s1)){
                    old.remove(s);
                    i--;
                }
            }
        }
        /*
        for (String s : old) {
            for (String s1 : old1) {
                if(s.equals(s1)){
                    old.remove(s);
                }
            }
        }*/

        for (String s : old) {
            System.out.println(s);
        }
    }
}
